<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="static/vue-2.5.16.js"></script>
</head>
<body>
<div id="app">
    <input type="button" value="show" @click="show">
    <br>
    <v1 @click1="show"></v1>
</div>
</body>
</html>
<script>
    Vue.component('v1', {
        template: '<input type="button" value="组件" @click="show2">',
        methods: {
            show2: function () {
                alert(2);
                this.$emit('click1',1);//向外公开事件click1，触发
            }
        }
    });

    var app = new Vue({
        el: '#app',
        methods: {
            show: function (n) {
                alert(n);
            }
        }
    });
</script>